<?php
/**
 *
 * @authors xiadx (xiadx@zpdchina.com)
 * @date    2017-03-05 20:42:53
 * @version $Id$
 */

class DataTizhengTemplateModel extends BaseModel {

	/**
     * 返回给终端的可执行sql语句的字段名称数组
     * @var [type]
     */
    public $_field_arr = ['tizheng_id','leibie','fangshi','max','min','danwei','edit_number','leibie_miaoshu','ztm','keshi','keyboardname', 'xiangmu_value', 'paixu', 'moban_leixing', 'guishu_shijian','biaodan_type', 'biaodan_ztm', 'empty_save'];

    public function ls($user_department='')
    {
    	$field_str = 'id as tizheng_id,leibie,fangshi,max,min,danwei,edit_number,leibie_miaoshu,ztm,keshi,keyboardname,xiangmu_value,paixu,moban_leixing,guishu_shijian,biaodan_type,biaodan_ztm,empty_save';
    	$query = DB::select($field_str)
    				->from('data_tizheng_template')
    				->where('yiyuan_id', '=', $this->yiyuan_id)
    				->and_where('keshi', '=', $user_department)
    				->or_where('keshi', '=', '通用')
                    ->execute()
                    ->as_array();
		return $query;
    }
}
